package huawei;

import java.util.*;
import java.util.stream.Collectors;

/**
 * 屏蔽
 */
public class Q85 {

    static Map<Integer, List<Character>> map = new HashMap<>();

    static {
        List<Character> list = new ArrayList<>();
        list.add('a');
        list.add('b');
        list.add('c');
        map.put(0, list);
        list = new ArrayList<>();
        list.add('d');
        list.add('e');
        list.add('f');
        map.put(1, list);
        list = new ArrayList<>();
        list.add('g');
        list.add('h');
        list.add('i');
        map.put(2, list);
        list = new ArrayList<>();
        list.add('j');
        list.add('k');
        list.add('l');
        map.put(3, list);
        list = new ArrayList<>();
        list.add('m');
        list.add('n');
        list.add('o');
        map.put(4, list);
        list = new ArrayList<>();
        list.add('p');
        list.add('q');
        list.add('r');
        map.put(5, list);
        list = new ArrayList<>();
        list.add('s');
        list.add('t');
        map.put(6, list);
        list = new ArrayList<>();
        list.add('u');
        list.add('v');
        map.put(7, list);
        list = new ArrayList<>();
        list.add('w');
        list.add('x');
        map.put(8, list);
        list = new ArrayList<>();
        list.add('y');
        list.add('z');
        map.put(9, list);
    }

    static List<Integer> int1 = null;
    static Set<Character> collect = null;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String string1 = sc.nextLine();
        String string2 = sc.nextLine();
        int1 = Arrays.stream(string1.split(" ")).map(String::trim).map(Integer::parseInt).collect(Collectors.toList());
        collect = Arrays.stream(string2.split(" ")).map(String::trim).map(e -> e.charAt(0)).collect(Collectors.toSet());

        find(0,  new StringBuilder());
    }

    public static void find(int i, StringBuilder sb) {

        // 是否出现屏蔽词
        Set<Character> happen = new HashSet<>();
        for (int j = 0; j < sb.length(); j++) {
            happen.add(sb.charAt(j));
        }
        if (happen.containsAll(collect)) {
            return;
        }

        // i 表示解析 j表示屏蔽词解析 j == -1 表示屏蔽词一个都没有使用
        if (i == int1.size()) {
            System.out.println(sb);
            return;
        }

        List<Character> list = map.get(int1.get(i));

        for (Character c : list) {
            sb.append(c);
            find(i + 1, sb);
            sb.deleteCharAt(sb.length() - 1);
        }
    }
}
